package com.Advance.abstract_;
/*
编写一个Employee类，声明为抽象类，包含以下三个属性：name，id，salary。提供必要的构造器和抽象方法：
work（）。对于Manager类来说，他既是员工，还具有奖金的属性。请使用继承的思想，设计CommonEmployee类和
Manager类，要求类中提供必要的方法进行属性访问，实现work（），提示：“经理/普通员工 名字 工作中...”
 */
public class abstract_test {
    public static void main(String[] args) {
        Manager manager = new Manager("smith","2024111",10000,5000);
        CommonEmployee commonEmployee = new CommonEmployee("jack","2024000",7000 );
        System.out.println(manager.work());
        System.out.println(commonEmployee.work());

    }
}
abstract class Employee{
    private String name;
    private String id;
    private double salary;
    public Employee(String name, String id, double salary) {
        this.name = name;
        this.id = id;
        this.salary = salary;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public abstract String work();
}
class Manager extends Employee{
    private double bonus;
    public Manager(String name, String id, double salary, double bonus) {
        super(name, id, salary);
        this.bonus = bonus;
    }
    public double getBonus() {
        return bonus;
    }
    public void setBonus(double bonus) {
        this.bonus = bonus;
    }
    @Override
    public String work() {
        return "经理"+ getName() + " " + getId() + " " + getSalary() + " " + getBonus()+"\n" + getName()+ "正在工作中...";
    }
}
class CommonEmployee extends Employee{
    public CommonEmployee(String name, String id, double salary) {
        super(name, id, salary);
    }
    public String work() {
        return "普通员工"+ getName() + " " + getId() + " " + getSalary() + "\n" + getName()+ "正在工作中...";
    }
}